From 89224a0296d7dee2c9caab343f0440f1a5841b83 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Fri, 22 Feb 2008 08:40:32 -0700 Subject: [PATCH] [IA64] Fix qemu memory access on IA64 - Correct a parameter to xc_map_foreign_batch(). skipping vga hole. - sync_icache() might overrun a page boundary. qemu-dm will die. This re-enables HVM support after cset 99478ffd81ee8685e6376210a1bd654c3790bf8d in linux-2.6.18-xen.hg Signed-off-by: Kouya Shimura --- tools/ioemu/hw/xen_machine_fv.c | 10 ++++++++-- tools/ioemu/target-i386-dm/exec-dm.c | 9 +++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/ioemu/hw/xen_machine_fv.c b/tools/ioemu/hw/xen_machine_fv.c index 272f67946f..2d02b5e136 100644 --- a/tools/ioemu/hw/xen_machine_fv.c +++ b/tools/ioemu/hw/xen_machine_fv.c @@ -246,14 +246,20 @@ static void xen_init_fv(uint64_t ram_size, int vga_ram_size, char *boot_device, for (i = 0; i < nr_pages; i++) page_array[i] = i; - + /* VTI will not use memory between 3G~4G, so we just pass a legal pfn to make QEMU map continuous virtual memory space */ - if (ram_size > MMIO_START) { + if (ram_size > MMIO_START) { for (i = 0 ; i < (MEM_G >> XC_PAGE_SHIFT); i++) page_array[(MMIO_START >> XC_PAGE_SHIFT) + i] = (STORE_PAGE_START >> XC_PAGE_SHIFT); } + /* skipping VGA hole, same as above */ + if (ram_size > VGA_IO_START) { + for (i = 0 ; i < (VGA_IO_SIZE >> XC_PAGE_SHIFT); i++) + page_array[(VGA_IO_START >> XC_PAGE_SHIFT) + i] = + (STORE_PAGE_START >> XC_PAGE_SHIFT); + } phys_ram_base = xc_map_foreign_batch(xc_handle, domid, PROT_READ|PROT_WRITE, diff --git a/tools/ioemu/target-i386-dm/exec-dm.c b/tools/ioemu/target-i386-dm/exec-dm.c index f408a74c1e..2ebdebff04 100644 --- a/tools/ioemu/target-i386-dm/exec-dm.c +++ b/tools/ioemu/target-i386-dm/exec-dm.c @@ -350,12 +350,13 @@ CPUReadMemoryFunc **cpu_get_io_memory_read(int io_index) * So to emulate right behavior that guest OS is assumed, we need to flush * I/D cache here. */ -static void sync_icache(unsigned long address, int len) +static void sync_icache(uint8_t *address, int len) { - int l; + unsigned long addr = (unsigned long)address; + unsigned long end = addr + len; - for(l = 0; l < (len + 32); l += 32) - __ia64_fc(address + l); + for (addr &= ~(32UL-1); addr < end; addr += 32UL) + __ia64_fc(addr); ia64_sync_i(); ia64_srlz_i(); -- 2.30.2